package com.java.www;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

import com.hxzy.dtjava.Student;

public class Cdemo {
	public static void main(String[] args) {
		Student student = new Student("С֣", "java001", 17);

		Socket socket = null;
		try {
			socket = new Socket("192.168.1.108", 8888);
			OutputStream os = socket.getOutputStream();
			ObjectOutputStream objectOutputStream = new ObjectOutputStream(os);
			objectOutputStream.writeObject(student);
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			if (socket != null) {
				try {
					socket.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}

		}

	}
}
